/**
 * @description: 取点器
 * @file: point-sphere.ts
 * @author: Evan
 * @date: 2025.07.17 14:13:51
 * @week: 周四
 * @version: V
 */

import { Scene } from '../class'

type ST = InstanceType<typeof Scene>

import { modelOpts } from './store'

export function pointSphere(core: ST) {
  return {
    add() {
      const gui = core.gui

      const model = core.setPiece
      const params = {
        scale: 1,
        delete: () => {
          core.modules.mian?.deleteModel({
            uuid: modelOpts.uuid
          })
        }
      }
      const group = gui.addFolder('取点球')
      group.add(model, 'visible').name('可见')
      group
        .add(params, 'scale', 0.01, 10)
        .step(0.01)
        .name('大小')
        .onChange(s => {
          model.scale.setScalar(s)
        })
      group.add(params, 'delete').name('删除选中(或删除键)')

      group.close()
    }
  }
}
